/*
 * Filename    : Graphic_Attach.java
 * Projectname : Sound Of Indonesia
 * Date        : Nov 1, 2012 , 2:31:09 PM 
 * 
 * PratamaNurWijaya
 */

package id.pratama.soundofindonesia.graphic;

import id.pratama.soundofindonesia.Utils;

import org.andengine.engine.camera.hud.HUD;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.sprite.Sprite;
import org.andengine.ui.activity.BaseGameActivity;


public class Graphic_Attach extends Graphic_Load
{

	public Graphic_Attach(BaseGameActivity activity, Scene m_Scene, HUD m_Hud)
	{
		super(activity, m_Scene, m_Hud);

	}

	public void attachLogo()
	{
		if (spr_Logo == null)
			spr_Logo = new Sprite(0, 0, Utils.getRatio(LOGO_WIDTH), Utils.getRatio(LOGO_HEIGHT), reg_Logo, getVertex());

		spr_Logo.setPosition((RES_WIDTH - spr_Logo.getWidth()) / 2, (RES_HEIGHT - spr_Logo.getHeight()) / 2);

		m_Scene.attachChild(spr_Logo);
	}

	public void attachMainBg()
	{
		if (spr_Menu_Bg == null)
			spr_Menu_Bg = new Sprite(0, 0, RES_WIDTH, RES_HEIGHT, reg_Menu_Bg, getVertex());
		m_Scene.attachChild(spr_Menu_Bg);
	}

	public void attachMenuDaerah()
	{

		for (int i = 0; i < MENU_DAERAH.length; i++)
		{
			if (spr_Menu_Daerah[i] == null)
				spr_Menu_Daerah[i] = new Sprite(0, 0, Utils.getRatio(MENU_DAERAH_WIDTH),
						Utils.getRatio(MENU_DAERAH_HEIGHT), reg_Menu_Daerah[i], getVertex());

			m_Scene.attachChild(spr_Menu_Daerah[i]);
			m_Scene.registerTouchArea(spr_Menu_Daerah[i]);
		}

		spr_Menu_Daerah[0].setPosition((RES_WIDTH / 2) - spr_Menu_Daerah[0].getWidth() / 2, (RES_HEIGHT / 2)
				- spr_Menu_Daerah[0].getHeight() / 2);

		for (int i = 1; i < MENU_DAERAH.length; i++)
		{
			spr_Menu_Daerah[i].setPosition(
					spr_Menu_Daerah[i - 1].getX() + spr_Menu_Daerah[i - 1].getWidth() + Utils.getRatio(160),
					(RES_HEIGHT / 2) - spr_Menu_Daerah[i].getHeight() / 2);
		}
	}
}
